﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ComponentModel;
using System.Text;
using Global.Class.Library;

namespace DataTransferObject.MetaDataList
{
    public class QuotaMaster : NotifyPropertyChangeObject
    {
        private int quotaID;

        private DateTime quotaDate;
        private DateTime entryDate;

        
        private int salesmenID;
        private int salesmenCategoryID;
        private int salesmenTypeID;
        private int salesmenAddressAreaID;
        private int locationID;
        private int departmentID;
        private int sectionID;
        private int teamID;
        private int employeeID;
        private int customerCategoryID;
        private int customerTypeID;
        private int customerChannelID;

        private string reference;
        private string description;
        private string other;   
     
        private double totalQuantityQuota;
        private double totalAmountQuota;

        private bool inActive;

        public QuotaMaster()
        {
            GlobalDefaultValue.Apply(this);
            this.QuotaDate = DateTime.Now;
            this.EntryDate = DateTime.Now;
        }

        #region Properties


        [DefaultValue(-1)]
        public int QuotaID
        {
            get { return this.quotaID; }
            set { ApplyPropertyChange<QuotaMaster, int>(ref this.quotaID, o => o.QuotaID, value); }
        }

        [DefaultValue(typeof(DateTime), "01/01/1900")]
        public DateTime QuotaDate
        {
            get { return this.quotaDate; }
            set { ApplyPropertyChange<QuotaMaster, DateTime>(ref this.quotaDate, o => o.QuotaDate, value); }
        }

        [DefaultValue(typeof(DateTime), "01/01/1900")]
        public DateTime EntryDate
        {
            get { return this.entryDate; }
            set { ApplyPropertyChange<QuotaMaster, DateTime>(ref this.entryDate, o => o.EntryDate, value); }
        }

        [DefaultValue(-1)]
        public int SalesmenID
        {
            get { return this.salesmenID; }
            set { ApplyPropertyChange<QuotaMaster, int>(ref this.salesmenID, o => o.SalesmenID, value); }
        }

        [DefaultValue(-1)]
        public int SalesmenCategoryID
        {
            get { return this.salesmenCategoryID; }
            set { ApplyPropertyChange<QuotaMaster, int>(ref this.salesmenCategoryID, o => o.SalesmenCategoryID, value); }
        }

        [DefaultValue(-1)]
        public int SalesmenTypeID
        {
            get { return this.salesmenTypeID; }
            set { ApplyPropertyChange<QuotaMaster, int>(ref this.salesmenTypeID, o => o.SalesmenTypeID, value); }
        }

        [DefaultValue(-1)]
        public int SalesmenAddressAreaID
        {
            get { return this.salesmenAddressAreaID; }
            set { ApplyPropertyChange<QuotaMaster, int>(ref this.salesmenAddressAreaID, o => o.SalesmenAddressAreaID, value); }
        }

        [DefaultValue(-1)]
        public int LocationID
        {
            get { return this.locationID; }
            set { ApplyPropertyChange<QuotaMaster, int>(ref this.locationID, o => o.LocationID, value); }
        }

        [DefaultValue(-1)]
        public int DepartmentID
        {
            get { return this.departmentID; }
            set { ApplyPropertyChange<QuotaMaster, int>(ref this.departmentID, o => o.DepartmentID, value); }
        }

        [DefaultValue(-1)]
        public int SectionID
        {
            get { return this.sectionID; }
            set { ApplyPropertyChange<QuotaMaster, int>(ref this.sectionID, o => o.SectionID, value); }
        }

        [DefaultValue(-1)]
        public int TeamID
        {
            get { return this.teamID; }
            set { ApplyPropertyChange<QuotaMaster, int>(ref this.teamID, o => o.TeamID, value); }
        }

        [DefaultValue(-1)]
        public int EmployeeID
        {
            get { return this.employeeID; }
            set { ApplyPropertyChange<QuotaMaster, int>(ref this.employeeID, o => o.EmployeeID, value); }
        }


        [DefaultValue(-1)]
        public int CustomerCategoryID
        {
            get { return this.customerCategoryID; }
            set { ApplyPropertyChange<QuotaMaster, int>(ref this.customerCategoryID, o => o.CustomerCategoryID, value); }
        }

        [DefaultValue(-1)]
        public int CustomerTypeID
        {
            get { return this.customerTypeID; }
            set { ApplyPropertyChange<QuotaMaster, int>(ref this.customerTypeID, o => o.CustomerTypeID, value); }
        }

        [DefaultValue(-1)]
        public int CustomerChannelID
        {
            get { return this.customerChannelID; }
            set { ApplyPropertyChange<QuotaMaster, int>(ref this.customerChannelID, o => o.CustomerChannelID, value); }
        }


        [DefaultValue("")]
        public string Reference
        {
            get { return this.reference; }
            set { ApplyPropertyChange<QuotaMaster, string>(ref this.reference, o => o.Reference, value); }
        }
        
        [DefaultValue("")]
        public string Description
        {
            get { return this.description; }
            set { ApplyPropertyChange<QuotaMaster, string>(ref this.description, o => o.Description, value); }
        }


        [DefaultValue("")]
        public string Other
        {
            get { return this.other; }
            set { ApplyPropertyChange<QuotaMaster, string>(ref this.other, o => o.Other, value); }
        }

        [DefaultValue(0)]
        public double TotalQuantityQuota
        {
            get { return this.totalQuantityQuota; }
            set { ApplyPropertyChange<QuotaMaster, double>(ref this.totalQuantityQuota, o => o.TotalQuantityQuota, value); }
        }

        [DefaultValue(0)]
        public double TotalAmountQuota
        {
            get { return this.totalAmountQuota; }
            set { ApplyPropertyChange<QuotaMaster, double>(ref this.totalAmountQuota, o => o.TotalAmountQuota, value); }
        }

        [DefaultValue(false)]
        public bool InActive
        {
            get { return this.inActive; }
            set { ApplyPropertyChange<QuotaMaster, bool>(ref this.inActive, o => o.InActive, value); }
        }

                
        #endregion

        protected override System.Collections.Generic.List<ValidationRule> CreateRules()
        {
            List<ValidationRule> validationRules = base.CreateRules();
            //validationRules.Add(new SimpleValidationRule("Reference", "Reference cannot be blank.", delegate { return this.Reference.Length != 0; }));
            validationRules.Add(new SimpleValidationRule("SalesmenID", "Salesmen cannot be empty.", delegate { return (this.SalesmenID > 0); }));
            validationRules.Add(new SimpleValidationRule("CustomerCategoryID", "Customer Class cannot be empty.", delegate { return (this.CustomerCategoryID > 0); }));
            validationRules.Add(new SimpleValidationRule("CustomerChannelID", "Customer Channel cannot be empty.", delegate { return (this.CustomerChannelID > 0); }));
            validationRules.Add(new SimpleValidationRule("CustomerTypeID", "Customer Type cannot be empty.", delegate { return (this.CustomerTypeID > 0); }));
            
            return validationRules;
        }
    }
}
